package com.etc.service.impl;

import ch.qos.logback.core.db.dialect.DBUtil;
import com.etc.dao.AdminMapper;
import com.etc.entity.Admin;
import com.etc.service.AdminService;
import com.etc.util.MD5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 管理员service实现层
 * Created by kl on 2019/5/25.
 */
@Service(value = "adminService")
public class AdminServiceImpl implements AdminService {
    @Autowired
    private AdminMapper adminMapper;

    @Override
    public Admin getAdminByName(String aname) {
        return adminMapper.selectByName(aname);
    }

    @Override
    public boolean addAdmin(Admin admin) {
        String pwd= MD5Util.getEncodeByMd5(admin.getApwd());
        admin.setApwd(pwd);
        return adminMapper.add(admin)>0;
    }
}
